<%@ page pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ page trimDirectiveWhitespaces="true" %>
<fmt:setLocale value="zh_CN"/>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>测试数据获取</title>
</head>
<style>
.select-ts { width:310px; padding:10px; border: 1px solid #dcdcdc;}
.select-ts td {font-size: 13px; padding:5px; }
.select-ts .ts-top {text-align: center;}
.select-ts .ts-top input { margin:0 5px; padding:4px 8px; font-size:13px; background:#e6e6e6; border-radius:3px; border: 1px solid #dcdcdc; }
.ts-tab { padding:10px 0 0; margin-top:15px; width: 100%; border-top: 1px solid #dcdcdc;}
</style>
<body>
<div id="select" class="select-ts">
	<div class="ts-top">
		<input type="button" id="TYSHXYDM" value="统一社会信用代码" data-build="regexp" data-rule="/^([1N]{1}[139]{1}|[248A]{1}[19]{1}|3[123459]{1}|5[12349]{1}|[67]{1}[129]{1}|9[123]{1}|Y1)\d{6}[^_IOZSVa-z\W]{10}$/g">
		<input type="button" id="SFZH" value="身份证号" data-build="regexp" data-rule="@id">
	</div>
</div>
<label id="aa"></label>
<script type="text/javascript"
		src="${ctxPath }/js/lib/jquery-1.12.4.min.js?20190117152252"></script>
<script type="text/javascript" src="${ctxPath }/test/mock.js?20190905095828"></script>
<script type="text/javascript">
//生成表格通用方法
	function showTable(jsonData,vtype){
		if($("#result")){
			$("#result").remove();
		}
		var showHtml = "<table id='result' class='ts-tab'>";
		for (var i = 0; i < jsonData.length; i++) {
            showHtml += "<tr>";
            var childData = jsonData[i];
            showHtml += "<td>" + vtype + "&nbsp;&nbsp;" + childData.result + "</td>";
            showHtml += "</tr>";
        }
		$("#select").append(showHtml);
	}
</script>
<script type="text/javascript">
//统一社会信用代码
$("#TYSHXYDM").on("click",function(){
	var jsonData = Mock.mock({
		'list|10':[{
			'result':'@cid'
		}]
	});
	showTable(jsonData.list,'统一社会信用代码：');
});
//身份证
$("#SFZH").on("click",function(){
	var jsonData = Mock.mock({
		'list|10':[{
			'result':'@id'
		}]
	});
	showTable(jsonData.list,'身份证号：');
});
</script>
</body>
</html>